package com.dhl.fin.api.domain;

import com.dhl.fin.api.common.domain.BasicDomain;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.List;

/**
 * Created by CuiJianbo on 2020.02.16.
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(name = "t_project")
public class Project extends BasicDomain {


    public Project() {
    }

    public Project(Long id) {
        this.id = id;
    }

    @Column(columnDefinition = "varchar(50) ")
    private String name;

    @Column(columnDefinition = "varchar(50) ")
    private String enName;


    @Column(columnDefinition = "varchar(50) ")
    private String code;


    @ManyToMany
    @JoinTable(name = "t_account_project",
            joinColumns = {@JoinColumn(name = "project_id")},
            inverseJoinColumns = {@JoinColumn(name = "account_id")})
    private List<Account> accounts;


    @OneToMany(mappedBy = "project")
    private List<Role> roles;

    /**
     * 菜单权限
     */
    @OneToOne
    @JoinColumn(name = "menu_tree_id")
    private Tree menuTree;

    /**
     * 数据权限
     */
    @OneToOne
    @JoinColumn(name = "data_tree_id")
    private Tree dataTree;


    @OneToMany(mappedBy = "project")
    private List<Dictionary> dictionaries;


}
